#pragma once

#include <QMessageBox>
#include <QSqlDatabase>
#include <QSqlError>
#include <QSqlQuery>

static bool createConnection()
{
    QSqlDatabase db = QSqlDatabase::addDatabase("QTDS7");//, "server=sql-vs;database=VankeMsg;uid=VankeMsg_sa;pwd=Msg070703;Max Pool Size=100");
	//db.setDatabaseName("Database=TangramNet;Server=tfsnew-szzb;Integrated Security=False;Password=testtest;User ID=test;");
	db.setHostName("tfsnew-szzb");
	db.setDatabaseName("TangramNet");
	db.setUserName("test");
	db.setPassword("testtest");
	db.setPort(1433);

	/*db.setHostName("sql-vs");
	db.setDatabaseName("VankeMsg");
	db.setUserName("VankeMsg_sa");
	db.setPassword("Msg070703");
	db.setPort(1433);*/

    if (!db.open()) {
        QMessageBox::critical(0, qApp->tr("Cannot open database"),
            qApp->tr("Unable to establish a database connection.\n"
                     "This example needs SQLite support. Please read "
                     "the Qt SQL driver documentation for information how "
                     "to build it.\n\n"
                     "Click Cancel to exit."), QMessageBox::Cancel);
        return false;
    }

    return true;
}
